package com.wm.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wm.system.domain.OldForNewService;
import com.wm.system.mapper.OldForNewServiceMapper;
import com.wm.system.service.IOldForNewServiceService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hyq
 * @since 2023-10-10 22:48:15
 */
@Service
public class OldForNewServiceServiceImpl extends ServiceImpl<OldForNewServiceMapper, OldForNewService> implements IOldForNewServiceService {

    @Override
    public List<OldForNewService> selectList(OldForNewService oldForNewService) {
        List<OldForNewService> list = this.lambdaQuery().eq(OldForNewService::getShopId, oldForNewService.getShopId())
                .list();
        return list;
    }

    @Override
    public void addOrUpdate(OldForNewService oldForNewService) {
        if(oldForNewService.getId()==null){
            oldForNewService.setCreateTime(LocalDateTime.now());
        }
        this.saveOrUpdate(oldForNewService);
    }
}
